colinuxfandomcom-20200214-history
NewKernel
Is it possible to run a new kernel under coLinux without applying any coLinux patches you ask. Take a look at this picture ! I'm not a kernel / Linux / net / everything Guru so if someone else wants to fix up this page with some comments - be my guest. 1. The first step (optional), is to get the newest coLinux available: Try here: http://www.henrynestler.com/colinux/testing/devel-0.8.0/20070412-gcc412/ Get devel-colinux-20070412-gcc412.tar.gz (or newer) and build it (read the DOCs). 2. While it builds make a couple of spare virtual HDs. See here for some tips: http://colinux.wikia.com/wiki/ExpandingRoot You will want one drive to be 2GB and the second around 6GB the third maybe 8-12GB. The first drive will be used to mount under coLinux with kernel version 2.6.17.x (I'll call this Linux_1) to copy the 2.6.22 (or whichever version) modules (and source) over to so it can be "loop mounted" in the new Linux and the modules installed (then re-boot). The second will be used to expand the root_filesystem image you choose since the one from the UML site is on a 1.5GB drive (that is too small). The third will be the coLinux mounted HD (but you move it inside your coLinux virtual HD and then add it directly to the new kernel's command line (ubdX) and mount it there) that holds the higher version of the kernel and the root_filesystem that you will be running (the NEW Linux (Debian, Fedora, etc) can be the same as you are running now or different. Basically you need the 2GB for the modules and source, 6GB to expand to new root_filesystem (if it is less than 2GB) and the 8-12GB drive to hold everything without eating up space on your coLinux virtual HD. Once the modules are installed you can delete the 2GB drive (if you will never need a tmp drive again and are short on space on your WinXP drive). 3. While you are building coLinux 0.8.0 (step 1) and making some more HDs (step 2) you can download a newer version of the Linux kernel from http://www.kernel.org/pub/linux/kernel/v2.6/ (I'll call this Linux_2). Choose a new version (but NOT _the_ newest - since you don't want too many bugs). Something from 2.6.22 is likely going to be better than a bleeding edge kernel - but get what you want ! If you want the same version as the UML page at sourceforge is using (to make thier instructions easier the first time you try this) then get this file: http://www.kernel.org/pub/linux/kernel/v2.6/testing/linux-2.6.22-rc2.tar.bz2 The newest kernels have more features. Get a 4 digit kernel with the last number the highest possible and the second to last number one less than the highest number possible. 4. While the drives are copying (and hour at least) and the kernel building open and read these web pages: http://user-mode-linux.sourceforge.net/ and http://user-mode-linux.sourceforge.net/source.html . You can Google other sites for help too. You can get the example root_filesystem from there (Fedora 5) that you can use instead of your current one or keep your current one if it is your preference. Thier example executable and root_filesystem has no modules so you will need the source code from kernel.org in any event. To use your current root_filesystem you will need a tiny copy of it. Take the small root_filesystem and copy it into a much bigger virtual HD containing your current root_filesystem. If you have a 2GB Debian file then make a copy of it and create an 8GB virtual drive. Copy the copy into the virtual drive and make sure it boots. Next shutdown and copy the 2GB file into the 8-12GB file (cofs mount it) as a file in your /UML directory. Like a big fish swallowing a small fish. The file in the file won't run when you start coLinux, it is for when you start the new kernel it needs a file system to read for it to boot. If someone know a simpler way to try to explain that, go ahead. I made the explanation long so it would be clearer (hopefully). If you don't get all the virtual HD's created (step 2) and have finished studying those web pages by this time then just go on to the next step and come back to finish what is left to do later. Try to at least get the 2GB virtual HD created first since you need it first. 5. After everything above is done install the fresh vmlinux (on WinXP by copying it through cofs0) and the modules go into /lib/modules (on coLinux virtual HD - just let "make modules_install" do it). Be certain to compile with module versioning on so you don't overwrite your old modules. Now type "shutdown -h now" to exit and then start coLinux again in the usual manner. 6. You now have kernel 2.7.17(.0)-co-0.8.0 running. Go to site: http://www.kernel.org/pub/linux/kernel/v2.6/ to check for the newest patches - if it is still .14 then change to your download directory and type this to get it: wget -nv http://www.kernel.org/pub/linux/kernel/v2.6/patch-2.6.17.14.bz2 Change to your linux-2.6.17-source directory and type something like this: bunzip2 -d -k -c /downloads/patch-2.6.17.14.bz2 | patch -p1 2>&1 \ | tee ../p-2.6.17.14_log.txt grep -v patching ../p-2.6.17.14_log.txt There should be only a couple of small rejects - fix them. If that is too hard then go no further - time for more reading / learning. 7. Build, install, re-boot to get coLinux with kernel 2.6.17.14-co-0.8.0 . Change to the build directory beneath your linux-2.6.17-source and you can either rename it linux-2.6.17.14-source so your not confused or leave it as-is (so if you ever try the 'official' coLinux build routine the scripts will see that you have a kernel build and will not rebuild it). The upgrade of coLinux is optional as far as running the newest kernel is concerned since this method will allow you to run a new kernel on an old one (though some features may not work). It makes sense to use the newest coLinux possible and patching up to .14 from .0 is very easy (though not officially supported by the authours of this website). I've used the above version for a while now - it works well but don't complain if it breaks since the authors of coLinux don't want to fix this hack - they only support official versions. So if you leave it at .0 and don't change it to .14 then Henry will appreciate any bug reports you might wish to send. Alter your colinux.conf file to mount all the new virtual drives you created. Later, the 6GB drive can be copied through your /mnt/windows drive to coLinux's new 8GB drive once you've expanded the Fedora (or whicher version of Linux OS you like). You might do this by adding these sort of lines to your coLinux.conf: cobd2=c:\colinux\drive_2.ext3.2GB cobd3=c:\colinux\drive_1.ext3.6GB # http://uml.nagafix.co.uk/FedoraCore5/FedoraCore5-x86-root_fs.bz2 (1.5GB (90M)) cobd5=c:\colinux\FedoraCore5-x86-root_fs cofs0=c:\ # Setup fast X11 networking too eth0=tuntap eth1=pcap-bridge eth2=slirp See http://colinux.wikia.com/wiki/Network#Introduction for info on setting up networking. The MS loopback driver should be at 10Mbps and the TAP-Win32 Adapter should run at 100Mbps. Connect coLinux to Cygwin's X11 on the fast link. You should be able to play DVDs at 1/4 screen size reasonably, but not perfectly (with a newer, fast computer) or you don't have your system setup correctly. Fast X11 is essential to your enjoyment of coLinux and not impossible to have. Create a shell script to start Xterm and enjoy a large screen instead of coLinux's small console. #!/bin/sh echo Starting Xterm export DISPLAY=192.168.37.20:0 xterm -bg black -fg white -fa Arial -fs 12 -geometry 120x32+15+5 \ -title "coLinux Xterm" -sb -rightbar -sl 10000 +cm +bdc 8. Untar your new kernel source in your /colinux/build directory (not /colinux/build/linux-2.6.17.x-build !) with a command like this: tar --bzip -xf /download/linux-2.6.22-rc2.tar.bz2 Now you have a directory which might be /colinux/build/linux-2.6.22-rc2 (depending on where you have your coLinux directories). Rename it and create a seperate build directory for the new kernel (Linux_2). cd /colinux/build mv linux-2.6.22-rc2 linux-2.6.22-rc2-source mkdir /colinux/build/linux-2.6.22-rc2-build Now you might type this: "ls -l /colinux/" and see something like this: drwxr-xr-x 14 root root 10240 Aug 4 21:13 build drwxr-xr-x 7 1000 users 1024 Jul 3 11:25 devel-colinux-20070412-gcc412 -rw-r--r-- 1 root root 3256320 Jun 22 20:10 devel-colinux-20070412-gcc412.tar drwxr-xr-x 7 1000 users 1024 Jun 22 20:41 devel-colinux-20070511 drwxr-xr-x 2 root root 1024 Apr 23 17:11 dist drwxr-xr-x 2 root root 1024 Jul 18 07:53 download drwxr-xr-x 2 root root 1024 Jul 24 02:46 log drwxr-xr-x 9 root root 1024 Jun 23 13:18 mingw32 Now you might type this: "ls -l /colinux/build" and see something like this: drwxrwxrwx 15 400 401 1024 Jan 22 2006 binutils-2.16.91-20060119-1 drwxr-xr-x 19 root root 1024 Jul 26 21:43 linux-2.6.17-build drwxrwxrwx 19 root root 1024 Jul 23 00:49 linux-2.6.17-source drwxr-xr-x 20 root root 3072 Aug 2 17:55 linux-2.6.22-rc2-build drwxr-xr-x 19 root root 1024 Aug 2 09:22 linux-2.6.22-rc2-source -rw-r--r-- 1 root root 188 Jul 22 13:25 p-2.6.17.14_log.txt Get the UML patches from sourceforge - they might be here: http://user-mode-linux.sourceforge.net/old/work/current/2.6/2.6.22/patches.tar ONLY patch ONE file (don't bother with all the patches, read them to see why). Patch file linux-2.6.22-rc2-source/arch/um/os-Linux/user_syms.c so you can compile without errors. It is a tiny patch that is necessary to build, most of the other patches do not apply to x86 or break something else. 9. Change to your kernel build directory and type something like (change if needed): cd /colinux/build/linux-2.6.22-rc2-build make -C /colinux/build/linux-2.6.22-rc2-source \ O=/colinux/build/linux-2.6.22-rc2-build defconfig ARCH=um Now type "make vmlinux modules modules_install". This will install the new kernel's modules (Linux_2 modules) in your present coLinux root_filesystem image (where they won't be used by linux-'2.6.17.14'), you have them copied there as a backup and they will work when copied over to the new kernel's root_filesystem. Follow the advice at http://colinux.wikia.com/wiki/ExpandingRoot to make your root_filesystem image (FedoraCore5-x86-root_fs ? ) bigger since at 1.5 GB it won't hold the modules and much else. Next rename it to something like FedoraCore5-x86-root_fs.ext3.6GB so you know the filetype and size. You can copy (or move) the 8GB drive through your windows mount (cofs0) to your coLinux virtual drive (to hide it from windows) and mount it inside coLinux as /UML --OR-- you can leave it on your windows drive and colinux-mount it with cobdx and then again mount it inside coLinux to /UML . Into this /UML drive (in coLinux's virtual HD) copy your newly built vmlinux to /UML/UML-linux-2.6.22-rc2 and the new OS root_filesystem image (Linux_2) to /UML/FedoraCore5-x86-root_fs.ext3.6GB . 10. Copy the modules from the coLinux /lib/modules/?? directory to the cobdx drive that is 2GB in size after mounting it like this: mount -t ext3 /UML/drive_spare.ext3.2GB /tmp/newfs -o loop cp --preserve=all /lib/modules/2.6.22-rc2/* /tmp/newfs/lib/modules/2.6.22-rc2/ cp -r --preserve=all /lib/modules/2.6.22-rc2/kernel/* /tmp/newfs/lib/modules/2.6.22-rc2/kernel/ umount /tmp/newfs That copies all the modules - you might want the source but not the build links if HD space is an issue. 11. Now you can run it like it was any other linux program. In coLinux type this: ./UML-linux-2.6.22-rc2-try4 ubda=/UML/FedoraCore5-x86-root_fs.ext3.6GB \ ubdb=/UML/drive_spare.ext3.2GB mem=256M eth0=tuntap,,,192.168.0.254 That runs the new Linux kernel inside the older kernel version hosted on coLinux which runs on WinXP and is accessed via XWindows running on Cygwin X11 (could use VNC). Login without a password as root (if using the sourceforge root_filesystem for FC5) and type "passwd root" to set a password (so you can login using ssh (which requires a passworded account) you might make the password 'root' for testing use). Now mount the drive with the modules you just copied and copy them to the 6GB expanded OS root. (Later, when you reboot the NEW OS, you can remove the 2GB drive and keep the 8-12GB one). mkdir /mnt/newfs mount -t ext3 /dev/ubdb /mnt/newfs cp -r --preserve=all /mnt/newfs/lib/modules/* /lib/modules/ cp -r --preserve=all /mnt/newfs/opt/colinux/build/linux-2.6.22-rc2-source/* /opt/colinux/build/linux-2.6.22-rc2-source/ 12. Login to FC5 2.6.22-rc2 (Linux_2) from Linux_1 (2.6.17.14): ssh -Y -l root 192.168.0.253 Type the 'root' password and you should see the screen-shot at the top of this posting. Now you can configure the Linux kernel with many more options than before and don't need to use coLinux patches on the new kernel. More software is compatable, though the networking is a bit tricky. You can also use the new kernel to run a firewall for the old kernel in a chroot jail and have all the fancy new kernel security features work for the old kernel! Keep the new kernel hidden or keep the old kernel hidden and use one to protect the other. There are lots of things you can do now. --- That may be tough to follow, can someone else explain better ? How things are 'exactly' depends on what kernel you decide to build and what you decide to name your directories (etc.), if you do the same as above before you alter everything it will be easier to follow the instructions. AFTER you are able to get a screen-shot like at the top then do your own thing. Notes: After you are finished you might have a (PARTIAL) directory structure on coLinux (depending on what you did) something like this: /colinux/build/... /colinux/build/linux-2.6.17-build/... /colinux/build/linux-2.6.17-source/... /colinux/build/linux-2.6.22-rc2-build/... /colinux/build/linux-2.6.22-rc2-source/... /UML/... /UML/FedoraCore5-x86-root_fs.ext3.6GB /UML/drive_spare.ext3.2GB After you are finished you might have a (PARTIAL) directory structure on WinXP (depending on what you did) something like this: \colinux\... \colinux\drive_spare.ext3.8GB The network is like this: |-----| |---------| |---------| |----------| | UML |---| coLinux |---| WinXP |---| Internet | |-----| |---------| | | |----------| \________| CygwinX |_ |---------| \_|---------| | WinXP's | | Video | | Monitor | |---------| There are pages on this site that will help you out. That is how I figured this out. Rob Comments ?